HAL CORTEX types migration ¶
This section provides information about the HAL CORTEX types migration .
HAL CORTEX MPU Region configuration type definition ¶
In HAL1, the MPU (Memory Protection Unit) region and attributes are configured using two structures: MPU_Region_InitTypeDef and MPU_Attributes_InitTypeDef.
In HAL2, the MPU region configuration is simplified and structured using the hal_cortex_mpu_region_config_t structure. This structure consolidates the configuration parameters for an MPU region. For the MPU_Attributes_InitTypeDef structure, it’s now set directly as an input in the config functions.
|
ARM Architecture |
HAL1 |
HAL2 |
|---|---|---|
|
ARMv8 |
typedef struct
{
uint8_t Enable;
uint8_t Number;
uint32_t BaseAddress;
uint32_t LimitAddress;
uint8_t AttributesIndex;
uint8_t AccessPermission;
uint8_t DisableExec;
uint8_t IsShareable;
} MPU_Region_InitTypeDef;
typedef struct
{
uint8_t Number;
uint8_t Attributes;
} MPU_Attributes_InitTypeDef;
|
typedef struct
{
/* The enable bit is set inside the HAL_CORTEX_MPU_EnableRegion() function */
/* The number of the region is passed as a parameter in HAL_CORTEX_MPU_SetConfigRegion() function */
uint32_t base_addr;
uint32_t limit_addr;
hal_cortex_mpu_mem_attr_idx_t attr_idx;
hal_cortex_mpu_region_access_attr_t access_attr;
hal_cortex_mpu_execution_attr_t exec_attr;
/* the shearability is removed */
} hal_cortex_mpu_region_config_t;
/* This structure is removed as we set these parameters as function inputs */
/* The Number is set with HAL_CORTEX_MPU_EnableRegion() */
/* The Attributes is set with HAL_CORTEX_MPU_SetDeviceMemAttr() or HAL_CORTEX_MPU_SetCacheMemAttr() */
|
|
ARMv7-M, ARMv6-M |
typedef struct
{
uint8_t Enable;
uint8_t Number;
uint32_t BaseAddress;
uint8_t Size;
uint8_t SubRegionDisable;
uint8_t TypeExtField;
uint8_t AccessPermission;
uint8_t DisableExec;
uint8_t IsShareable;
uint8_t IsCacheable;
uint8_t IsBufferable;
} MPU_Region_InitTypeDef;
|
typedef struct
{
/* The enable bit is set inside the HAL_CORTEX_MPU_EnableRegion() function */
/* The number of the region is passed as a parameter in HAL_CORTEX_MPU_SetConfigRegion() function */
uint32_t base_addr;
hal_cortex_mpu_region_size_t size;
uint8_t sub_region;
/* Combined with other defines into "mem_attr" parameter */
hal_cortex_mpu_region_access_attr_t access_attr;
hal_cortex_mpu_execution_attr_t exec_attr;
/* Combined with the rest of parameters into "mem_attr" parameter */
hal_cortex_mpu_mem_attr_t mem_attr;
} hal_cortex_mpu_region_config_t;
|